<!-- ChildComponent.vue -->
<template>
  <el-input
      v-model="localValue"
      :placeholder="placeholder"
      :prefix-icon="prefixIcon"
      :type="type"
      :show-password="showPassword"
      class="custom-input"
  />
</template>

<script setup>
import { computed, defineProps, defineEmits } from 'vue'

const props = defineProps({
  modelValue: {
    type: String,
    required: true
  },
  placeholder: String,
  prefixIcon: Object,
  type: {
    type: String,
    default: 'text'
  },
  showPassword: Boolean
})

const emits = defineEmits(['update:modelValue'])

// 创建可写计算属性
const localValue = computed({
  get: () => props.modelValue,
  set: (val) => emits('update:modelValue', val)
})
</script>
